<?php
/* @var $this RebatecommissionController */
/* @var $model Rebatecommission */

$this->breadcrumbs=array(
	Yii::t('base','Rebatecommission')=>array('admin'),
	Yii::t('base','Manage'),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#rebatecommission-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1><?php echo Yii::t('base','Manage Rebatecommissions')?></h1>

<?php 
echo Yii::t('base','<p>
You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>');
?>

<?php echo CHtml::link(Yii::t('base','Advanced Search'),'#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); 
$model->type=1;
?>
</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'rebatecommission-grid',
	'dataProvider'=>$model->search(),
	'itemsCssClass'=>'responsive table table-striped table-bordered',
	// 'pagerCssClass'=>'pagination pull-right',
	'pager'=>array('class'=>'CLinkPager','hiddenPageCssClass'=>'','firstPageCssClass'=>'first paginate_button','htmlOptions'=>array('class'=>'dataTables_paginate paging_full_numbers"'),'header'=>""),
	'pagerCssClass'=>'pagination',
	'cssFile'=>false,
	'template'=>'{items}{summary}{pager}',
	'columns'=>array(
		array('name'=>'user_id','value'=>'User::model()->find("user_id=".$data->user_id)->user_name'),
		'date',
		'fandian_rate',
		array(
		'name'=>'fandian_id',
		'type'=>'raw',
		'value'=>'CHtml::link($data->fandian_id,array("fandian/view",id=>$data->fandian_id))',//名称和URL
),
		'number',
		'money',
		array('name'=>'id','value'=>'Rebatecommission::model()-> getcommissionNumber($data->agent_company_id,$data->user_id,$data->date)'),
		array('name'=>'agent_company_id','header'=>Yii::t('base','Amount'),'value'=>'Rebatecommission::model()-> getAmount($data->money,$data->agent_company_id,$data->user_id,$data->date)'),
		//array('name'=>'type','value'=>'Rebatecommission::model()->gettype($data->type)'),
		array(
			'class'=>'CButtonColumn',
			'header'=>Yii::t('base','Operate'),
			'updateButtonImageUrl'=>array('class'=>'gicon-edit'),
			'updateButtonOptions'=>array('class'=>'btn btn-small'),
			'deleteButtonImageUrl'=>array('class'=>'gicon-edit'),
			'deleteButtonOptions'=>array('class'=>'btn btn-inverse btn-small'),
			'template'=>'{delete}{update}',
		),
	),
)); ?>
